package com.mxpio.erp.common.equipment.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.equipment.entity.EquipmentCheckTaskDetail;
import com.mxpio.erp.common.equipment.entity.EquipmentCheckTaskTransfer;
import com.mxpio.erp.common.equipment.entity.EquipmentPersonGroup;
import com.mxpioframework.jpa.annotation.DictAble;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 点检任务
 * @Author: jeecg-boot
 * @Date:   2021-09-23
 * @Version: V1.0
 */
@Data
public class EquipmentCheckTaskPage implements DictAble, Serializable {

    private static final long serialVersionUID = 1L;

	/**主键*/
	@Schema(description = "主键")
	private String id;
	/**工单编码*/
	@Schema(description = "工单编码")
	private String orderCode;
	/**目标类型*/
    @Dict(dicCode = "tpm_task_target_type")
	@Schema(description = "目标类型")
	private String targetType;
	/**目标ID*/
	@Schema(description = "目标ID")
	private String targetId;
	/**目标名称*/
	@Schema(description = "目标名称")
	private String targetName;
	/**目标编码*/
	@Schema(description = "目标编码")
	private String targetCode;
	/**设备型号*/
	@Schema(description = "设备型号")
	private String targetSpec;
	/**所属区域*/
	@Schema(description = "所属区域")
	private String areaName;
	/**具体位置*/
	@Schema(description = "具体位置")
	private String position;
	/**工单状态*/
	@Schema(description = "工单状态")
	private String orderStatus;
	/**生成类型*/
	@Schema(description = "生成类型")
	private String createType;
	/**计划开始时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "计划开始时间")
	private Date planStartTime;
	/**计划结束时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "计划结束时间")
	private Date planEndTime;
	/**下达目标类型*/
    @Dict(dicCode = "tpm_release_target_type")
	@Schema(description = "下达目标类型")
	private String releaseTargetType;
	/**下达目标*/
    @Dict(dicEntity = User.class, dicText = "realname", dicCode = "username")
	@Schema(description = "下达目标")
	private String releaseTargetId;
    /**下达目标*/
    @Schema(description = "下达目标名称")
    private String releaseTargetName;
	/**是否自动下达*/
    @Dict(dicCode = "yes_no")
	@Schema(description = "是否自动下达")
	private Integer isAutoRelease;
	/**部门/群组责任人*/
	@Schema(description = "部门/群组责任人")
	private String director;
	/**计划下达时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "计划下达时间")
	private Date planReleaseTime;
	/**派工模式*/
    @Dict(dicCode = "tpm_dispatch_mode")
	@Schema(description = "派工模式")
	private String dispatchMode;
	/**实际开始时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "实际开始时间")
	private Date actualStartTime;
	/**实际结束时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "实际结束时间")
	private Date actualEndTime;
	/**滞后下达*/
    @Dict(dicCode = "yes_no")
	@Schema(description = "滞后下达")
	private Integer isLag;
	/**滞后下达时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "滞后下达时间")
	private Date lagTime;
	/**执行人*/
	@Schema(description = "执行人")
	private String executor;
	/**设备开关机状态*/
    @Dict(dicCode = "yes_no")
	@Schema(description = "设备开关机状态")
	private String eqpStatus;
	/**下达时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "下达时间")
	private Date releaseTime;
	/**派工时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "派工时间")
	private Date dispatchTime;
	/**派工操作人*/
	@Schema(description = "派工操作人")
	private String dispatchUser;
	/**创建人*/
	@Schema(description = "创建人")
	private String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "创建日期")
	private Date createTime;
	/**更新人*/
	@Schema(description = "更新人")
	private String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@Schema(description = "更新日期")
	private Date updateTime;
	/**所属部门*/
	@Schema(description = "所属部门")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
	private String createDept;

	@Schema(description = "点检任务明细")
	private List<EquipmentCheckTaskDetail> equipmentCheckTaskDetailList;
	@Schema(description = "点检任务转单历史")
	private List<EquipmentCheckTaskTransfer> equipmentCheckTaskTransferList;

//	@Column(name = "CHECK_GROUP_CODE_")
	@Schema(description = "点检群组")
	@Dict(dicCode="groupCode", dicEntity = EquipmentPersonGroup.class, dicText = "groupName")
	private String checkPersonGroupCode;

    private Map<String, String> textMap;
    @Override
    public String putText(String key, String value) {
        if (textMap == null) {
            textMap = new HashMap<>();
        }
        return textMap.put(key, value);
    }

}
